<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <link rel="stylesheet" href="css/user/public.css">
    <link rel="stylesheet" href="css/user/index.css">
    <!--引入CSS-->
    <link rel="stylesheet" type="text/css" href="css/user/webuploader.css">
    <!--引入CSS-->
    <link rel="stylesheet"  href="css/user/webuploader.css">
    <link rel="stylesheet"  href="css/user/bootstrap-datepicker.css">

    <!--引入JS-->

    <script language="javascript" type="text/javascript" src="js/user/jquery-1.8.3.min.js"></script>
    <script language="javascript" type="text/javascript" src="js/user/index.js"></script>
    <script language="javascript" type="text/javascript" src="js/user/area.js"></script>
    <script language="javascript" type="text/javascript" src="js/user/uploadPreview.js"></script>
    <script language="javascript" type="text/javascript" src="js/user/webuploader.js"></script>
    <script language="javascript" type="text/javascript" src="js/user/ajaxfileupload.js"></script>
    <script language="javascript" type="text/javascript" src="js/user/lt-upload-file.js"></script>
    <script language="javascript" type="text/javascript" src="js/user/jquery.timepicker.js"></script>
    <script language="javascript" type="text/javascript" src="js/user/bootstrap-datepicker.js"></script>
    <script>
    	<!--
        window.onload = function () {
            new uploadPreview({ UpBtn: "up_img", DivShow: "imgdiv", ImgShow: "imgShow" });
            new uploadPreview({ UpBtn: "up_img1", DivShow: "imgdiv1", ImgShow: "imgShow1" });
            new uploadPreview({ UpBtn: "up_img2", DivShow: "imgdiv2", ImgShow: "imgShow2" });
            new uploadPreview({ UpBtn: "up_img3", DivShow: "imgdiv3", ImgShow: "imgShow3" });
            new uploadPreview({ UpBtn: "up_img4", DivShow: "imgdiv4", ImgShow: "imgShow4" });
            new uploadPreview({ UpBtn: "up_img5", DivShow: "imgdiv5", ImgShow: "imgShow5" });
        }
			-->
    </script>
    <title>发布项目</title>
</head>
<body>
<!--top-->
<div class="contact_main">
    <div class="contact_main_title">
        <p>发布项目</p>
    </div>
    <div class="contact_main_cont">
        <form id="release_box">
            <div class="release_form_box">
                <p><span>项目名称：</span><input type="text" id="release_name" value=""/></p>
                <p class="release_form_photo1"><span>添加项目LOGO：</span></p>
                <div  class="release_form_photo_five add_logo">
                    <p><a id="projLogoBtn" class="a-upload"><input type="file" name="photoFileHelp" id="projLogoFile" onChange="document.getElementById('subProjLogo').click();" style="display:none;" />请上传项目LOGO</a></p>
          					<input type="button" name="subProjLogo" id="subProjLogo" value="确认上传" style="display:none;"/>
                    <div id="imgdiv"><img  width="150" height="150" id="projLogoShow" src="images/none_03.png"/></div>
                    <div class="cleardiv"></div>
                    <p><a class="a-upload_yl">预览</a></p>

                </div>
                <div class="cleardiv"></div>
                <p><span>项目领域：</span><select class="release_xmly"><option value="1">智慧医疗</option><option value="2">互联网基础服务</option></select></p>
                <p><span>所在地区：</span><select id="s_province" name="s_province"></select><select id="s_city" name="s_city" ></select></p>
                <p><span>融资主主体：</span><select class="release_zt"><option value="1">A轮</option><option value="2">B轮</option><option value="3">C轮</option></select></p>
                <p><span>融资金额：</span><select class="release_money"><option value="100">100万元</option><option value="200">200万元</option></select></p>
                <p><span>融资释放比例：</span><input type="text" class="release_bl"/><em style="margin-left:10px;">%</em></p>
                <p class="release_form_photo1"><span>添加企业LOGO：</span></p>
                <div  class="release_form_photo_five add_logo">
                	
                	 <p><a id="companyLogoBtn" class="a-upload"><input type="file" name="photoFileHelp" id="companyLogoFile" onChange="document.getElementById('subCompanyLogo').click();" style="display:none;" />请上传企业LOGO</a></p>
          					<input type="button" name="subCompanyLogo" id="subCompanyLogo" value="确认上传" style="display:none;"/>
                    <div id="imgdiv"><img  width="150" height="150" id="companyLogoShow" src="images/none_03.png"/></div>
                    
                    <div class="cleardiv"></div>
                    <p><a class="a-upload_yl">预览</a></p>

                </div>
                <div class="cleardiv"></div>
                <p class="release_form_photo"><span>企业证件：</span><input type="radio" value="五证合一" name="1" checked><label>五证合一</label><input type="radio" name="1" value="企业三证"><label>企业三证</label></p>
                <div  class="release_form_photo_five">
                	
                		<p><a id="fiveCardBtn" class="a-upload"><input type="file" name="photoFileHelp" id="fiveCardFile" onChange="document.getElementById('subFiveCardFile').click();" style="display:none;" />请上传证件</a></p>
          					<input type="button" name="subFiveCardFile" id="subFiveCardFile" value="确认上传" style="display:none;"/>
                   
                    <label>请上传JPG/GIF/PNG/BMP格式图片，文件大小控制在5M以内！</label></p>
                    <div id="imgdiv"><img  width="150" height="150" id="fiveCardShow" src="images/none_03.png"/></div>
                    
                    <div class="cleardiv"></div>
                    <p><a class="a-upload_yl">预览</a></p>
                </div>
                <div  class="release_form_photo_three" style="display: none;">
                    <p>
                    	<p><a id="companyLicenseBtn" class="a-upload"><input type="file" name="photoFileHelp" id="companyLicenseFile"  onChange="document.getElementById('subCompanyLicenseFile').click();" style="display:none;" />营业执照</a>
          					  <input type="button" name="subCompanyLicenseFile" id="subCompanyLicenseFile" value="确认上传" style="display:none;"/>
          					
          						<a id="companyCodecardBtn" class="a-upload"><input type="file" name="photoFileHelp" id="companyCodecardFile" onChange="document.getElementById('subCompanyCodecardFile').click();" style="display:none;" />组织机构代码证</a>
          						<input type="button" name="subCompanyCodecardFile" id="subCompanyCodecardFile" value="确认上传" style="display:none;"/>
          					
          						<a id="taxRegisterBtn" class="a-upload"><input type="file" name="photoFileHelp" id="taxRegisterFile" onChange="document.getElementById('subTaxRegisterFile').click();" style="display:none;" />税务登记证</a></p>
          						<input type="button" name="subTaxRegisterFile" id="subTaxRegisterFile" value="确认上传" style="display:none;"/>
          					<!--
                    	<a class="a-upload"><input type="file" id="up_img1" value="" style="border:none;">营业执照</a>
                    	<a class="a-upload"><input type="file" id="up_img2" value="" style="border:none;">组织机构代码证</a>
                    	<a class="a-upload"><input type="file" id="up_img3" value="" style="border:none;">税务登记证</a>
                    -->	
                    	<label>请上传JPG/GIF/PNG/BMP格式图片，文件大小控制在5M以内！</label></p>
                    	<div id="imgdiv"><img width="150" height="150" id="companyLicenseFileShow" src="images/none_03.png"/>
                   	  <img  width="150" height="150" id="companyCodecardFileShow" src="images/none_03.png"/>
                   	  <img  width="150" height="150" id="taxRegisterFileShow" src="images/none_03.png"/></div>
                    
                    <div class="cleardiv"></div>
                    <p><a class="a-upload_yl">预览</a><a class="a-upload_yl">预览</a><a class="a-upload_yl">预览</a></p>
                </div>
            </div>
            <div class="release_form_sm">
                <p><span>项目简介：</span><textarea name="message" cols="28" rows="5" onKeyDown="textCounter(message,remLen,100);" onKeyUp="textCounter(message,remLen,100);" id="release_xmjj"></textarea><span class="release_ts"><em class="textCount"><input name="remLen" type="text" readonly="readonly" value="0"></em>/100</span></p>
                <p><span>近三年财务数据：</span><textarea name="message1" cols="28" rows="5" onKeyDown="textCounter(message1,remLen1,100);" onKeyUp="textCounter(message1,remLen1,100);" id="release_three_sj"></textarea><span class="release_ts"><em class="textCount"><input name="remLen1" type="text" readonly="readonly" value="0"></em>/100</span></p>
                <p><span>未来三年财务预算：</span><textarea name="message2" cols="28" rows="5" onKeyDown="textCounter(message2,remLen2,100);" onKeyUp="textCounter(message2,remLen2,100);" id="release_three_ys"></textarea><span class="release_ts"><em class="textCount"><input name="remLen2" type="text" readonly="readonly" value="0"></em>/100</span></p>
                <p><span>本次融资资金用途：</span><textarea name="message3" cols="28" rows="5" onKeyDown="textCounter(message3,remLen3,100);" onKeyUp="textCounter(message3,remLen3,100);" id="release_three_zjyt"></textarea><span class="release_ts"><em class="textCount"><input name="remLen3" type="text" readonly="readonly" value="0"></em>/100</span></p>
                <p><span>项目市场分析：</span><textarea name="message4" cols="28" rows="5" onKeyDown="textCounter(message4,remLen4,100);" onKeyUp="textCounter(message4,remLen4,100);" id="release_three_scfx"></textarea><span class="release_ts"><em class="textCount"><input name="remLen4" type="text" readonly="readonly" value="0"></em>/100</span></p>
                <p><span>竞争对手分析：</span><textarea name="message5" cols="28" rows="5" onKeyDown="textCounter(message5,remLen5,100);" onKeyUp="textCounter(message5,remLen5,100);" id="release_three_jzds"></textarea><span class="release_ts"><em class="textCount"><input name="remLen5" type="text" readonly="readonly" value="0"></em>/100</span></p>
                <!--<p><span>团队成员履历：</span><textarea name="message6" cols="28" rows="5" onKeyDown="textCounter(message6,remLen6,100);" onKeyUp="textCounter(message6,remLen6,100);" id="release_three_number"></textarea><span class="release_ts"><em class="textCount"><input name="remLen6" type="text" readonly="readonly" value="0"></em>/100</span></p>-->
                <p class="base_infor_form_tz_lv"><span>团队成员履历：</span></p>
                <div>
                    <div class="base_infor_form_tz_lv_cont_box">
                        <div class="base_infor_form_tz_lv_cont1">
                            <p><span>职务：</span><input type="text" class="release_member_zw"></p>
                            <p><span>姓名：</span><input type="text" class="release_member_name"></p>
                            <p><span>属性：</span><input type="text" class="release_member_sx"></p>
                            <p><span>技术类：</span><input type="text" class="release_member_js"></p>
                            <p class="base_infor_form_tz_qj1" id="basicExample"><span>任职时间：</span><input type="text" class="date start" /><em>~</em><input type="text" class="date end" /></p>
                            <p><span>背景介绍：</span><textarea class="release_member_bj" name="message" cols="28" rows="5" onKeyDown="textCounter(message,remLen,100);" onKeyUp="textCounter(message,remLen,100);"></textarea><span class="release_ts"><em class="textCount"><input name="remLen" type="text" readonly value="0"></em>/100</span></p>
                        </div>
                    </div>
                    <div class="cleardiv"></div>
                </div>
                <div class="cleardiv"></div>

                <p><a href="javascript:void (0);" class="cont_add1" onclick="add_member();">继续添加</a></p>
                <p><span>自定义添加：</span><textarea name="message7" cols="28" rows="5" onKeyDown="textCounter(message7,remLen7,100);" onKeyUp="textCounter(message7,remLen7,100);" id="release_three_add"></textarea><span class="release_ts"><em class="textCount"><input name="remLen7" type="text" readonly="readonly" value="0"></em>/100</span></p>
                <p class="release_form_sm_ts"><span>项目联系人：</span><input type="text" id="release_person"/></p>
                <p class="release_form_sm_ts"><span>项目电话：</span><input type="text" id="release_phone"/></p>
                <p class="release_form_sm_ts"><span>附件：</span><a><input type="file"></a></p>
            </div>
            <p class="release_btn_tj_box"><input id="release_btn" type="button" value="提交" class="release_btn_tj"></p>
        </form>
    </div>
    <script type="text/javascript">_init_area();</script>
    <div class="cleardiv"></div>
</div>
<!--main-->
<!--mask-->
<div class="register_mask_box"></div>
<div class="register_mask_cont_box">
    <div class="register_mask_cont_title">
        <p><span>提示</span><a class="register_mask_close"><img src="images/mask_close_03.png"></a></p>
    </div>
    <div class="cleardiv"></div>
    <div class="register_mask_cont_cont">
        <!--<p>保存失败！</p>-->
        <!--<p><input type="submit" value="确定"/></p>-->
    </div>
</div>
<!--mask-->
<script>
	
 $(document).ready(function(){
			//上传项目logo
			$("#projLogoBtn").click(function() {
				document.getElementById("projLogoFile").click();
			});
			$("input#subProjLogo").click(function() {
				ajaxFileUpload4Add("/lt/file/upload", "projLogoShow", "projLogoFile");
			});
			//上传企业logo
			$("#companyLogoBtn").click(function() {
				document.getElementById("companyLogoFile").click();
			});
			$("input#subCompanyLogo").click(function() {
				ajaxFileUpload4Add("/lt/file/upload", "companyLogoShow", "companyLogoFile");
			});
			
			//五证合一
			$("#fiveCardBtn").click(function() {
				document.getElementById("fiveCardFile").click();
			});
			$("input#subFiveCardFile").click(function() {
				ajaxFileUpload4Add("/lt/file/upload", "fiveCardShow", "fiveCardFile");
			});
			
			//营业执照
			$("#companyLicenseBtn").click(function() {
				document.getElementById("companyLicenseFile").click();
			});
			$("input#subCompanyLicenseFile").click(function() {
				ajaxFileUpload4Add("/lt/file/upload", "companyLicenseFileShow", "companyLicenseFile");
			});
			
			//组织机构代码证
			$("#companyCodecardBtn").click(function() {
				document.getElementById("companyCodecardFile").click();
			});
			$("input#subCompanyCodecardFile").click(function() {
				ajaxFileUpload4Add("/lt/file/upload", "companyCodecardFileShow", "companyCodecardFile");
			});
			
			//税务登记证
			$("#taxRegisterBtn").click(function() {
				document.getElementById("taxRegisterFile").click();
			});
			$("input#subTaxRegisterFile").click(function() {
				ajaxFileUpload4Add("/lt/file/upload", "taxRegisterFileShow", "taxRegisterFile");
			});
  	});
  	
    $(document).ready(function(){
        var ids = location.href.split('?')[1];
        if(ids){
            getJson();
        }
        var id = null;
       
        $('#release_btn').click(function(){
            ajaxFn();
            function  ajaxFn(){
                var projectName = $("#release_name").val();
                var industry=$(".release_xmly").find("option:selected").val();
                var project_p=$("#s_province").find("option:selected").val();
                var project_city=$("#s_city").find("option:selected").val();
                var project_release_zt=$(".release_zt").find("option:selected").val();
                var project_release_money=$(".release_money").find("option:selected").val();
                var project_release_bl = $(".release_bl").val();
                var project_release_xmjj = $("#release_xmjj").val();
                var project_release_three_sj = $("#release_three_sj").val();
                var project_release_three_ys = $("#release_three_ys").val();
                var project_release_three_zjyt = $("#release_three_zjyt").val();
                var project_release_three_scfx = $("#release_three_scfx").val();
                var project_release_three_jzds = $("#release_three_jzds").val();
                var project_release_three_number = $("#release_three_number").val();
                var project_release_three_add = $("#release_three_add").val();
                var project_release_person = $("#release_person").val();
                var project_release_phone = $("#release_phone").val();
//                alert(project_release_person);
                var cityCode1 = project_city || project_p;
                //获取投资案例
                var amember_infor = new Array;
                var nLength = $('.base_infor_form_tz_lv_cont1').length;
                for(var i =0; i<nLength; i++){
                    var member_zw = $('.release_member_zw').eq(i).val();
                    var member_name = $('.release_member_name').eq(i).val();
                    var member_sx = $('.release_member_sx').eq(i).val();
                    var member_js = $('.release_member_js').eq(i).val();
                    var startTime = $('.start').eq(i).val();
                    var endTime = $('.end').eq(i).val();
                    var member_bj = $('.release_member_bj').eq(i).val();
                    amember_infor.push({name:member_name,title:member_zw,jobStartTime :startTime,jobEndTime :endTime,introduce:member_bj})
                }
                console.log(amember_infor);

//                alert(cityCode1)
                var test_ajax = $.ajax({
                    url:"lt/user/saveProject",
                    data:JSON.stringify({id:id,projectName:projectName,industry:industry,cityCode:cityCode1,phase:project_release_zt,finaceMoney:project_release_money,sellShares:project_release_bl,introduce:project_release_xmjj,financialData:project_release_three_sj,financialBudget:project_release_three_ys,financingPurposes:project_release_three_zjyt,marketAnaly:project_release_three_scfx,rivalAnaly:project_release_three_jzds,memberIntro:project_release_three_number,otherInfo:project_release_three_add,contactor:project_release_person,phone:project_release_phone,memberIntro :JSON.stringify(amember_infor)}),
                    type:"POST",
                    contentType: "application/json",
             		    dataType:"json",
                    success:function(data){
                       if(data.result != 0){
                			    handlerError(data);
                			}else{
                            $(".register_mask_box").show();
                            $(".register_mask_cont_box").show();
                            $(".register_mask_cont_cont").append("<p>保存成功！</p><p><input type='submit' value='确定' class='register_mask_cont_cont_btn'/></p>");
//                            $('#release_box').submit();
//                            console.log(cityCode);

                        }
                    }
                });
            }
        });
        function getJson(){
        	
            var test_ajax = $.ajax({
                url:"lt/user/getProjDetail",
                data:{id:ids},
                type:"get",
                success:function(data){
									
                    if(data.result != 0){
                    	handlerError(data);
             		   }else{
                        var publishData = data.data;
                        
                        $("#release_name").val(publishData.projectName);
                        $("#projLogoShow").attr("src", publishData.logoUrl);
                        $("#release_xmly").val(publishData.industry);
                        $("#s_province").val(publishData.cityCode);
                        $("#s_city").val(publishData.cityCode);
                        $(".release_zt").val(publishData.phase);
                        $(".release_money").val(publishData.finaceMoney);
                        $(".release_bl").val(publishData.sellShares);
                        $("#imgShow1").attr("src",publishData.busiLicensePath);
                        $("#imgShow2").attr("src",publishData.orgCodecardPath);
                        $("#imgShow3").attr("src",publishData.taxRegisterPath);
                        $("#release_xmjj").val(publishData.introduce);
                        $("#release_three_sj").val(publishData.financialData);
                        $("#release_three_ys").val(publishData.financialBudget);
                        $("#release_three_zjyt").val(publishData.financingPurposes);
                        $("#release_three_scfx").val(publishData.marketAnaly);
                        $("#release_three_jzds").val(publishData.rivalAnaly);
                        $("#release_three_add").val(publishData.otherInfo);
//                        $("#release_three_number").val(publishData[ids-1].memberIntro);
                        $("#release_person").val(publishData.contactor);
                        $("#release_phone").val(publishData.phone);
                        $(".release_fj").val(publishData.attachmentPath);
                        if(publishData.memberIntro) {
                        	var memLength=JSON.parse(publishData.memberIntro).length;
                        }
                        
//                        alert(ids)
//                        alert(memLength.length);
                        $(".base_infor_form_tz_lv_cont_box").html("");
                        for(i=0;i<=memLength.length;i++){

                        var _html="<div class='base_infor_form_tz_lv_cont1'>" +
                            "<p><span>职务：</span><input type='text' class='release_member_zw' value='"+memLength[i].title+"'></p>" +
                        "<p><span>姓名：</span><input type='text' class='release_member_name' value='"+memLength[i].name+"'></p>" +
                        "<p><span>属性：</span><input type='text' class='release_member_sx' value=''></p>" +
                        "<p><span>技术类：</span><input type='text' class='release_member_js' value=''></p>" +
                        "<p class='base_infor_form_tz_qj1' id='basicExample'><span>任职时间：</span><input type='text' class='date start' value='"+memLength[i].jobStartTime+"'/><em>~</em><input type='text' class='date end' value='"+memLength[i].jobEndTime+"'/></p>" +
                        "<p><span>背景介绍：</span><textarea class='release_member_bj' name='message' cols='28' rows='5' onKeyDown='textCounter(message,remLen,100);' onKeyUp='textCounter(message,remLen,100);' value=''>"+memLength[i].introduce+"</textarea><span class='release_ts'><em class='textCount'><input name='remLen' type='text' readonly value='0'></em>/100</span></p>" +
                        "<a class='base_infor_form_del'>删除</a>" +
                        "</div>";

                            $(".base_infor_form_tz_lv_cont_box").append(_html);
                            var main = $(window.parent.document).find("#iframepage");
                            var thisheight = $(document).height();
                            main.height(thisheight);
                        }

                    }
                }
            });
        }
    })
    $(".register_mask_cont_cont_btn").live("click",function(){
        $(".register_mask_box").hide();
        $(".register_mask_cont_box").hide();
    })
</script>
<script>
    $('#basicExample .date').datepicker({
        'format': 'yyyy-mm-dd',
        'autoclose': true
    });
    $('#basicExample .date').datepicker({
        'format': 'yyyy-mm-dd',
        'autoclose': true
    });

    //$('#basicExample').datepair();
</script>
</body>
</html>